From 0f9547258106c33b9ebf6e13b6b43df013f537ac Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Wed, 2 Mar 2016 11:10:29 +0100 Subject: [PATCH] gtkwindow: Use default size even if not resizable If a window is not resizable (with gtk_window_set_resizable ()), the size given with gtk_window_set_default_size() is ignored. The solution to this would be to use gtk_widget_set_size_request() but that's a GtkWidget API and therefore does not take into account the client side decorations when in use with GtkWindow. Refactor the code so that gtk_window_set_default_size() (which is a GtkWindow API) gives the expected result on non-resizable windows as well. bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=762974 --- gtk/gtkwindow.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 920f60776b..008f630094 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -9133,6 +9133,14 @@ gtk_window_compute_configure_request (GtkWindow *window, gtk_window_compute_configure_request_size (window, &new_geometry, new_flags, &w, &h); + /* If not resizeable, set min/max to what we have */ + if (!priv->resizable) + { + new_flags |= GDK_HINT_MAX_SIZE; + + new_geometry.max_width = new_geometry.min_width = w; + new_geometry.max_height = new_geometry.min_height = h; + } gtk_window_constrain_size (window, &new_geometry, new_flags, @@ -9862,13 +9870,6 @@ gtk_window_compute_hints (GtkWindow *window, new_geometry->max_height = MAX (new_geometry->max_height, new_geometry->min_height); } - else if (!priv->resizable) - { - *new_flags |= GDK_HINT_MAX_SIZE; - - new_geometry->max_width = new_geometry->min_width; - new_geometry->max_height = new_geometry->min_height; - } *new_flags |= GDK_HINT_WIN_GRAVITY; new_geometry->win_gravity = priv->gravity; -- 2.30.2